With development of network technologies, a software-defined networking (SDN) technology is put forward as an innovation to a network architecture, and main technical features of the software-defined networking technology include separating forwarding from control, centralized management and control of a network, and supporting open programming to open network resources and capabilities. An objective of an SDN is to simplify management and control of a network by reconstructing a network architecture, so as to accelerate deployment of a new service. OpenFlow is a mainstream key technology for implementing an SDN, and defines an interface and a protocol for communication between a network controller and a network forwarding device. In the OpenFlow-based SDN network, a concept of a group is introduced, such that a set of a group of ports is used as a single entity, where the single entity is used to forward a packet, and a group table is used to store a group entry. In the group entry, one identifier (ID) is used to uniquely identify one group entry. A group type represents a service type supported by the group. A counter is used to collect statistics on traffic of the group. An action bucket is used to specify an action bucket associated with the group entry. Different group types may support different services. An entry of an action bucket includes an identifier, a weight, and an operation (for example, forwarding to a port) of a bucket, where the weight is used to determine a ratio of data forwarded on each forwarding path.
In the SDN network, a general method for constructing a multipath forwarding rule is: 1) defining a group, specifying that a group type is select, which represents that a data packet is forwarded by selecting a port from multiple action buckets according to a particular rule/algorithm; and specifying an action bucket of the group, for example, specifying multiple forwarding port numbers and weights; and 2) constructing a flow entry, including a match field and an action field, where an action field part is defined as pointing to an entry in a group table.
However, storage resources of the forwarding device are limited, and a quantity of hardware flow tables supported by a group table is also limited. Therefore, reuse of a group is particularly important for saving storage space. In some approaches, to reuse a group, the controller needs to query an already used group, determines, through comparison, whether a port combination in an action bucket in a historical group is consistent with that in a group to be established, and when the port combination in the action bucket in the historical group is consistent with that in the group to be established, uses an identifier of the historical group as an identifier of a newly established group. When there is a relatively large quantity of groups on which multipath forwarding is performed, there is a relatively large quantity of port combinations. Querying for the identifier of the historical group generates large overheads, affecting a time for establishing a flow table on the forwarding device, and reducing working efficiency of the controller and the forwarding device.